package com.chen.jwt.config;

import com.chen.jwt.interceptors.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 若晨
 * @version 1.0.0
 * @ClassName InterceptorConfigration.java
 * @Description TODO
 * @createTime 2022年08月02日 22:15:00
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    //添加拦截器

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(new JWTInterceptor())
               //其他接口token要验证
               .addPathPatterns("/user/test")
               //所有用户都放行
               .excludePathPatterns("user/login","/swagger-resources/**","/swagger-ui.html/**");
    }
}
